﻿
#ifndef MAINTASK_H
#define MAINTASK_H
#include <time.h>
#include <unistd.h>
#include <QDebug>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <termios.h>
#include <QDebug>
#include <QObject>
#include <QThread>
#include<QMutex>
#include "uart.h"
#include "weighttask.h"
#include <QVariant>
#include<QHash>
#include "datebase.h"
#include "udpsocket.h"
#include "fileinfo.h"
#include"contorlcamera.h"
#include"outrfid.h"
class maintask : public QThread
{
    Q_OBJECT
public:
    explicit maintask(QObject *parent = 0);
    //扫描FTP下抓拍图片
    FileInfo scanFile;
    QHash<QString,QString> HashPlate;
protected:
    void run();

    void IsdynamicWeight();

    void IsStaticWeight();
    udpSocket* udp;

    bool IsUdp;

    int Num;


    //动态磅标志位
    bool IsGetWeight;
    bool IsGetAxis;
signals:
    void sendUdpMes(QVariant);
    void sendXmlCarInfo(QString,QString,QString);
    void sendXmlRecord(QString str);
    void signalsetpar();
public slots:
    void MaintaskRun();
    void slotGet();

    //low config
    void LowConfig();
    //high config
    void HighConfig();
    void Delay_MSec(int msec);

    void slotReciveRifd(const QString& cid);
    void slotReciveOutRfid(const QString& cid);
    void slotReciveIntoRfid(const QString& cid);
private:
    QString RF_CarPlate;
    QString RF_Tare;
    QString RF_CarType;
    void AnalyCarInfo();
    void InitPlate();
    void AnalyCarType(CarType& type,int car_type);
    bool AnalyzeCarInfo(QString rfid, CardInfo &car_info, QHash<QString, QString>& hash);

    bool test;
    bool m_outtest;
    QString tempstr;

    QString m_Rfid;
    QString m_OutRfid;
    QString m_IntoRfid;
};

#endif // MAINTASK_H
